package com.igeek.yygh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.igeek.yygh.mapper.ServiceMapper;
import com.igeek.yygh.model.Servicenty;
import com.igeek.yygh.model.elders.Elders;
import com.igeek.yygh.service.ServiceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.igeek.yygh.vo.PageQueryVO;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-08-21
 */
@Service
public class ServiceServiceImpl extends ServiceImpl<ServiceMapper, Servicenty> implements ServiceService {

    @Override
    public Page<Servicenty> findPage(PageQueryVO vo) {
        Integer currentPage = vo.getCurrentPage();
        Integer pageSize = vo.getPageSize();
        String queryString = vo.getQueryString();
        //封装Page对象
        Page<Servicenty> page = new Page<>(currentPage , pageSize);
        //封装查询条件
        LambdaQueryWrapper<Servicenty> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(StringUtils.hasLength(queryString) , Servicenty::getServicename , queryString);
        //分页查询数据
        Page<Servicenty> checkitemPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);
        return checkitemPage;
    }
}
